﻿<%@ Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" 
CodeBehind="ViewContract.aspx.cs" Inherits="ContractManagementSystem.ViewAllContract" Title="Untitled Page" %>
<%@ Register TagPrefix="cc1" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=3.0.30512.20315, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PanelContent" runat="server">
    <div class="divWrap">

        <script type="text/javascript">
            function confirmPost()
            {
        	    var agree = confirm("Are you sure you want to delete?");
        	    if (agree)
        		    return true;
        	    else
        		    return false;
            }
        </script>

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Panel runat="server" ID="ViewPanel">
                    <h2 class="divTitle">
                        View Contract</h2>
                    <fieldset style="width: 98%; margin: auto; padding-left: 7px;padding-bottom: 10px;" class="border">
                        <legend><b>Search</b></legend>
                        <table style="width: 80%;margin: 0 auto">
                            <tr>
                                <td style="width: 390px;padding-left: 50px">
                                    ContractType
                                    <asp:DropDownList runat="server" ID="ContractTypeViewDropDownList" AutoPostBack="true"
                                    OnSelectedIndexChanged="ContractTypeViewDropDownList_OnSelectedIndexChanged"/>
                                </td>
                                <td>StartDate</td>
                                <td>
                                    <asp:TextBox ID="StartTextBox" Enabled="False" BackColor="white" runat="server"></asp:TextBox>
                                    <asp:ImageButton ID="ImageBirthDate" runat="server" CssClass="calender" ImageUrl="~/Images/calendar.png" />
                                    <cc1:CalendarExtender ID="CalendarExtender3" CssClass="cal_Theme1" runat="server"
                                        TargetControlID="StartTextBox" PopupButtonID="ImageBirthDate" PopupPosition="BottomRight">
                                    </cc1:CalendarExtender>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 390px;padding-left: 50px">
                                    <asp:TextBox runat="server" ID="ContractorNameTextBox" placeholder="Contractor 's name"
                                        ToolTip="Contractor 's name" Width="222px"></asp:TextBox>
                                </td>
                                <td>
                                    EndDate
                                </td>
                                <td>
                                    <asp:TextBox ID="EndTextBox" Enabled="False" BackColor="white" runat="server"></asp:TextBox>
                                    <asp:ImageButton ID="ImageButton1" runat="server" CssClass="calender" ImageUrl="~/Images/calendar.png" />
                                    <cc1:CalendarExtender ID="CalendarExtender1" CssClass="cal_Theme1" runat="server"
                                        TargetControlID="EndTextBox" PopupButtonID="ImageButton1" PopupPosition="BottomRight">
                                    </cc1:CalendarExtender>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: center" colspan="3">
                                    <asp:Button runat="server" ID="SearchButton" Text="Search" 
                                    ToolTip="Search" OnClick="SearchButton_OnClick"/>
                                    <asp:Button runat="server" ID="ClearButton" Text="Clear" 
                                    ToolTip="Clear Search" OnClick="ClearButton_OnClick"/>
                                </td>
                            </tr>
                        </table>
                    </fieldset>
                    <asp:ListView ID="ContractListView" runat="server" ItemPlaceholderID="NewItem">
                        <LayoutTemplate>
                            <table id="table">
                                <tr>
                                    <th>
                                        <asp:LinkButton runat="server" ToolTip="Sort" CommandName="Sort" CommandArgument="ContractorName"
                                            ID="LinkButton6">Contractor</asp:LinkButton>
                                    </th>
                                    <th>
                                        <asp:LinkButton runat="server" ToolTip="Sort" CommandName="Sort" CommandArgument="ContractType"
                                            ID="LinkButton7">ContractType</asp:LinkButton>
                                    </th>
                                    <th>
                                        <asp:LinkButton runat="server" ToolTip="Sort" CommandName="Sort" CommandArgument="Manager"
                                            ID="LinkButton8">Manager</asp:LinkButton>
                                    </th>
                                    <th>
                                        <asp:LinkButton runat="server" ToolTip="Sort" CommandName="Sort" CommandArgument="Consultant"
                                            ID="LinkButton9">Consultant</asp:LinkButton>
                                    </th>
                                    <th>
                                        <asp:LinkButton runat="server" ToolTip="Sort" CommandName="Sort" CommandArgument="StartDate"
                                            ID="LinkButton10">StartDate</asp:LinkButton>
                                    </th>
                                    <th>
                                        <asp:LinkButton runat="server" ToolTip="Sort" CommandName="Sort" CommandArgument="EndDate"
                                            ID="LinkButton11">EndDate</asp:LinkButton>
                                    </th>
                                    <th>
                                        <div align="center">
                                            Action</div>
                                    </th>
                                </tr>
                                <tr>
                                    <asp:PlaceHolder runat="server" ID="NewItem"></asp:PlaceHolder>
                                </tr>
                            </table>
                        </LayoutTemplate>
                        <EmptyDataTemplate>
                            <h4 class="empty">
                                There are no items to show in this view.</h4>
                        </EmptyDataTemplate>
                        <ItemTemplate>
                            <tr class="odd">
                                <td style="text-align: left; padding-left: 10px;">
                                    <%#Eval("ContractorName")%>
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <%#Eval("ContractTypeName")%>
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <%#Eval("ManagerName")%>
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <%#Eval("ConsultantName")%>
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <asp:Label runat="server" ID="StartDateLabel" Text='<%#Eval("StartDate","{0:MM/dd/yyyy}")%>' />
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <asp:Label runat="server" ID="EndDateLabel" Text='<%#Eval("EndDate","{0:MM/dd/yyyy}")%>' />
                                </td>
                                <td>
                                    <div style="text-align: center">
                                        <asp:LinkButton runat="server" ToolTip="Edit" ID="editLinkButton"
                                            CssClass="edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ContractId") %>'
                                            OnCommand="EditOnCommand"></asp:LinkButton>
                                        <asp:LinkButton runat="server" ToolTip="Delete" ID="deleteButton1"
                                            CssClass="delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ContractId") %>'
                                            OnCommand="DeleteOnCommand" OnClientClick="return confirmPost()"></asp:LinkButton>
                                    </div>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <AlternatingItemTemplate>
                            <tr class="alt">
                                <td style="text-align: left; padding-left: 10px;">
                                    <%#Eval("ContractorName")%>
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <%#Eval("ContractTypeName")%>
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <%#Eval("ManagerName")%>
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <%#Eval("ConsultantName")%>
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <asp:Label runat="server" ID="StartDateOddLabel" Text='<%#Eval("StartDate","{0:MM/dd/yyyy}")%>' />
                                </td>
                                <td style="text-align: left; padding-left: 10px;">
                                    <asp:Label runat="server" ID="EndDateOddLabel" Text='<%#Eval("EndDate","{0:MM/dd/yyyy}")%>' />
                                </td>
                                <td>
                                    <div style="text-align: center;">
                                        <asp:LinkButton runat="server" ToolTip="Edit" ID="editLinkButton"
                                            CssClass="edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ContractId") %>'
                                            OnCommand="EditOnCommand"></asp:LinkButton>
                                        <asp:LinkButton runat="server" ToolTip="Delete" ID="deleteButton1"
                                            CssClass="delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ContractId") %>'
                                            OnCommand="DeleteOnCommand" OnClientClick="return confirmPost()"></asp:LinkButton>
                                    </div>
                                </td>
                            </tr>
                        </AlternatingItemTemplate>
                    </asp:ListView>
                    <asp:Panel runat="server" ID="PagePanel">
                        <div class="divPage">
                            <asp:LinkButton ID="FirstPageButton" Text="First" runat="server" OnClick="FirstPageButtonClick" />
                    <asp:LinkButton ID="PreviewPageButton" Text="Preview" runat="server" OnClick="PreviewPageButtonClick" />
                    <asp:Label ID="PageLabel" runat="server" CssClass="curent"></asp:Label>
                    <asp:LinkButton ID="NextPageButton" Text="Next" runat="server" OnClick="NextPageButtonClick" />
                    <asp:LinkButton ID="LastPageButton" Text="Last" runat="server" OnClick="LastPageButtonClick" />
                        </div>
                    </asp:Panel>
                </asp:Panel>
                <asp:Panel runat="server" ID="EditPanel">
                    <h1 class="title">
                        Edit Contract</h1>
                    <table style="height: 100%; width: 58%; margin: 0 auto;">
                        <tr>
                            <td>
                                Contractor
                            </td>
                            <td>
                                <asp:DropDownList ID="ContractorDropDownList" runat="server" Width="170px" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                ContractType
                            </td>
                            <td>
                                <asp:DropDownList ID="ContractTypeDropDownList" runat="server" Width="170px" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Line Manager
                            </td>
                            <td>
                                <asp:DropDownList ID="ManagerDropDownList" runat="server" Width="170px" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Consultant
                            </td>
                            <td>
                                <asp:DropDownList ID="ConsultantDropDownList" runat="server" Width="170px" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                StartDate
                            </td>
                            <td>
                                <asp:TextBox runat="server" ID="StartDateTextBox"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                EndDate
                            </td>
                            <td>
                                <asp:TextBox runat="server" ID="EndDateTextBox"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Content
                            </td>
                            <td>
                                <asp:TextBox runat="server" ID="ContentTextBox" TextMode="MultiLine" Height="100px"
                                    Width="309px" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: center">
                                <asp:Button runat="server" ID="UpdateButton" Text="Update" OnClick="UpdateButtonClick" />
                                <asp:Button runat="server" ID="BackButton" Text="Back" OnClick="BackButtonClick" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>


